package com.isoftstone.merchant.dao.mdept;


import com.isoftstone.common.Page;
import com.isoftstone.merchant.entity.mdept.MDept;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface MDeptMapper {


    int deleteByPrimaryKey(@Param("deptId")String dId);

    int insert(MDept record);

    void addDept( MDept mDept)throws Exception;

    MDept selectByPrimaryKey(@Param("deptId")String deptId) throws Exception;

    int updateByPrimaryKeySelective(MDept mDept);

    int updateByPrimaryKey(MDept mDept);

    List<MDept> getDeptlistPage(Page page);

    List<MDept> getDeptAllTree();

    MDept getMDeptBymId(String corpId) throws Exception;

    List<MDept> getDeptAll(@Param("corpId")String corpId);

    List<MDept> getDeptAll1(@Param("corpId")String corpId);

    MDept getRootDept(@Param("corpId") String corpId)throws Exception;

    String selectdept(@Param("deptName") String deptName, @Param("superDeptId")String superDeptId, @Param("corpId") String corpId)throws Exception;

    MDept getparaentDept(@Param("deptId") String deptId);

    List<MDept> tongjiDepts(@Param("deptId") String deptId);

    //缴费用户使用
    MDept selectDeptByIdFeeUser(@Param("deptId") String deptId,@Param("superDeptId")String superDeptId);

    List<MDept> getAllDeptByCorpId(@Param("corpId") String corpId)throws Exception;

    void insertFirstdept(@Param("dept") MDept dept) throws Exception;
    //批量导入
    List<MDept> selectDeptByNameAndLevel(Map<String, Object> map);

    MDept selectDeptBySuperId(Map<String, Object> map);

    String getUserDeptById( String deptId) throws Exception;

    List<MDept> getParentDeptByIdandCorpId(@Param("deptId") String deptId, @Param("corpId") String corpId)throws Exception;

    MDept getDeptTree(String deptId,String corpId)throws Exception;

    List<MDept> getTestDeptAll(@Param("superId")String deptId)throws Exception;

    MDept getdeptById(@Param("deptId") String deptId) throws Exception;
    //线下收费
    MDept getDeptBySuperId(@Param("superId")String superId)throws Exception;

    /**
     * 手机端增加缴费用户的时候查询机构
     * @param superId
     * @return
     * @throws Exception
     */
    List<MDept> queryDeptBySuperId(@Param("superId")String superId)throws Exception;

    List<MDept> getDeptlistBySuperId(String deptId)throws Exception;

    List<MDept> getUpDeptAll(@Param("deptId") String deptId)throws Exception;

    String getDeptNameBydeptId(@Param("deptId") String deptId)throws Exception;

    Integer getleavlBydeptIdandCorpId(@Param("deptId") String deptId, @Param("corpId") String corpId)throws Exception;

    String getdeptIdBydeptId(@Param("deptId") String deptId)throws Exception;

    List<MDept> getDeptBySupId(@Param("superDeptId") String superDeptId)throws Exception;

    List<MDept> getalldeptByUserId(@Param("userId") String userId)throws Exception;
}